#ifndef __CIM_NICE_H__
#define __CIM_NICE_H__

#include <stdint.h>
#include <hbird_sdk_soc.h>


//1.custom NICE_push
__STATIC_FORCEINLINE void NICE_push(int addr,uint32_t config)
{
	int zero = 0;
	asm volatile(
		".insn r 0x7b,3,0x11,x0,%1,%2"
			:"=r"(zero)
			:"r"(addr),"r"(config)
	);
}
//2.custom NICE_save
__STATIC_FORCEINLINE void NICE_save(int addr,uint32_t config)
{
	int zero = 0;
	asm volatile(
		".insn r 0x7b,3,0x12,x0,%1,%2"
			:"=r"(zero)
			:"r"(addr),"r"(config)
	);
}
//3.custom NICE_mvm
__STATIC_FORCEINLINE void NICE_mvm(uint32_t matrix_index,uint32_t matrix_length)
{
	int zero = 0;
	asm volatile(
		".insn r 0x7b,3,0x01,x0,%1,%2"
			:"=r"(zero)
			:"r"(matrix_index),"r"(matrix_length)
	);
}


//4.custom NICE_config
__STATIC_FORCEINLINE void NICE_config(uint32_t config_rs1,uint32_t config_rs2)
{
	int zero = 0;
	asm volatile(
		".insn r 0x7b,3,0x02,x0,%1,%2"
			:"=r"(zero)
			:"r"(config_rs1),"r"(config_rs2)
	);
}

#endif //CIM_H
